//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.8.4/xslt/JavaClass.xsl

package com.novix.struts.action;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.novix.portal.framework.model.impl.WebContact;
import com.novix.portal.framework.util.IConstants;

/**
 * MyEclipse Struts Creation date: 05-30-2005
 * 
 * XDoclet definition:
 * 
 * @struts:action path="/viewDetail" name="viewDetailForm"
 *                input="/form/viewDetail.jsp" scope="request"
 * @struts:action-forward name="success" path="/form/viewDetail.jsp"
 */
public class ViewDetailAction extends Action {

    // --------------------------------------------------------- Instance
    // Variables

    // --------------------------------------------------------- Methods

    /**
     * Method execute
     * 
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     */
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
        DynaActionForm viewDetailForm = (DynaActionForm) form;
        List list = (List) request.getSession().getAttribute(IConstants.WEB_CONTACT_COMPLETE_LIST);
        Map map = new HashMap();
        for (Iterator iter = list.iterator(); iter.hasNext();) {
            WebContact element = (WebContact) iter.next();
            map.put(element.getId(), element);
        }
        WebContact contactDoc = (WebContact) map.get(request.getParameter("id"));
        request.setAttribute(IConstants.CONTACT_DOC, contactDoc);
        return mapping.findForward(IConstants.SUCCESS);
    }

}